<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="../../static/news/css/reset.css">
    <link rel="stylesheet" type="text/css" href="../../static/news/css/main.css">
    <script type="text/javascript" src="../../static/news/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="../../static/news/js/main.js"></script>
</head>
<body>
<style type="text/css">
    body {
        background-image: url("static/news/images/bbb.jpg");
        background-repeat: no-repeat;
        background-size: 100% 100%;
        background-attachment: fixed;
    }
</style>
<script>
    $(function () {
        $('.login_form_con1').show();
        $('body').css({"background-img": "url(news/images/aaaa.jpg)"})
        // TODO 登录表单提交
        $(".login_form_con1").submit(function (e) {
            e.preventDefault()
            var mobile = $(".login_form #mobile").val()
            var password = $(".login_form #password").val()

            if (!mobile) {
                $("#login-mobile-err").show();
                return;
            }

            if (!password) {
                $("#login-password-err").show();
                return;
            }

            // 发起登录请求
            // 拼接参数
            var params = {
                "mobile":mobile,
                "password":password
            }

            $.ajax({
                url:'/passport/Media_login',
                type:'post',
                data:JSON.stringify(params),
                contentType:'application/json',
                headers:{'X-CSRFToken':getCookie('csrf_token')},
                success: function (resp) {
                    //判断是否登陆成功
                    if(resp.errno == '0'){
                        window.location.replace("/user/info");
                    }else{
                        alert(resp.errmsg);
                    }

                }
            })

        })
    })
</script>
<form class="login_form_con1">
    <div class="login_form">
        <div class="login_title">
            <h3>自媒体用户登录</h3>
            <a href="javascript:;" class="shutoff"></a>
        </div>
        <div class="form_group">
            <input id="mobile" type="text" name="mobile" autocomplete="off">
            <div class="input_tip">手机号</div>
            <div id="login-mobile-err" class="error_tip">手机号不能为空</div>
        </div>
        <div class="form_group">
            <input id="password" type="password" name="password">
            <div class="input_tip">密码(不少于6位)</div>
            <div id="login-password-err" class="error_tip">密码不能为空</div>
        </div>
        <input type="submit" name="" value="登 录" class="input_sub">
        <div class="down_link"><a href="/" class="to_register">返回主页</a></div>
    </div>
    <div class="mask"></div>
</form>
</body>
</html>